package com.ygqh.baby.service;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.Date;

import com.foxinmy.weixin4j.exception.WeixinException;
import com.foxinmy.weixin4j.http.HttpClientException;
import com.ygqh.baby.ao.Message;
import com.ygqh.baby.service.wechat.model.Action.ActionType;
import com.ygqh.baby.service.wechat.model.UserActionReport.Aggregation;
import com.ygqh.baby.service.wechat.model.UserActionReport.TimeGranularity;
import com.ygqh.baby.service.wechat.model.UserActionSet;
import com.ygqh.baby.service.wechat.model.UserActionSet.Type;

public interface WxMpUserActionService {

	/**
	 * 创建用户行为数据源
	 * 
	 * @param type
	 * @param name
	 * @param description
	 * @return
	 * @throws WeixinException
	 * @throws HttpClientException
	 */
	Message addUserActionSets(UserActionSet userActionSet) throws WeixinException, HttpClientException;

	/**
	 * 获取用户行为数据源
	 * 
	 * @param userActionSetId
	 * @return
	 * @throws WeixinException
	 * @throws HttpClientException
	 */
	Message findUserActionSets(String userActionSetId) throws HttpClientException, WeixinException;

	/**
	 * 上报网页转化行为数据
	 * 
	 * @param clickId
	 *            落地页URL中的click_id
	 * @param currentUrl
	 *            转化行为发生页面的URL
	 * @param actionType
	 *            预定义的行为类型
	 * @param totalPrice
	 *            订单金额
	 * @return
	 * @throws WeixinException
	 * @throws HttpClientException
	 * @throws SQLException 
	 */
	Message userActions(String clickId, String currentUrl, ActionType actionType, BigDecimal totalPrice, Type type, Long userId) throws WeixinException, HttpClientException, SQLException;

	/**
	 * 获取用户行为数据源报表
	 * 
	 * @param userActionSetId
	 * @param startDate
	 * @param endDate
	 * @param timeGranularity
	 * @param aggregation
	 * @return
	 * @throws HttpClientException
	 * @throws WeixinException
	 */
	Message findUserActionSetReports(String userActionSetId, Date startDate, Date endDate, TimeGranularity timeGranularity, Aggregation aggregation)
			throws HttpClientException, WeixinException;

}
